package cn.tedu.review;
/* 本类用于复写多线程实现方案2:实现Runnable*/
public class TestRunnable {
    public static void main(String[] args) {
        //创建目标业务类对象--只创建一次
        MyRunnable target = new MyRunnable();
        //创建多个线程对象
        Thread t1 = new Thread(target);
        Thread t2 = new Thread(target);
        Thread t3 = new Thread(target);
        Thread t4 = new Thread(target);
        Thread t5 = new Thread(target);
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
//作为目标业务类
class MyRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+"="+i);
        }
    }
}
